<?php
	function connect(){mysql_connect("127.0.0.1", "root");
		mysql_select_db ("nitpicker");
		}
	function query($query, $params) {
		foreach($params as $param) {
			$query = preg_replace("/\?/", '"' . mysql_real_escape_string($param) . '"', $query, 1);
		}
		
		$result= mysql_query($query);
		if($result === FALSE) {
			print mysql_error();
			die();
		}
		if($result==1) {
		return;}
		if (mysql_num_rows($result) == 0) {
		return array();
		}
		$result_rows= array();
		while ($row = mysql_fetch_assoc($result)) {
			$result_rows[] = $row;
			}
		return $result_rows;
	}
	function close () {mysql_close();
	}	